package com.eastfair.auth.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.auth.enumeration.OrganizationOrgTypeEnum;
import com.eastfair.auth.enumeration.OrganizationVestTypeEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author ligang
 * @since 2023-04-24
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("c_organization")
@ApiModel(value = "Organization", description = "")
@AllArgsConstructor
public class Organization extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 组织名称
     */
    @ApiModelProperty(value = "组织名称")
    @Size(max = 255, message = "组织名称长度不能超过255")
    @TableField(value = "name", condition = LIKE)
    @Excel(name = "组织名称")
    private String name;

    /**
     * 组织类型#{P:厦门智慧场馆;P_VENUE:场馆业务管理系统;P_CERTIFICATE:证件管理系统;P_COMPOSITE_VENUE:综合-场馆管理; P_COMPOSITE_COURT:综合-主场管理;P_COMPOSITE_PRODUCER:综合-搭建商管理;P_COMPOSITE_TRANSPORT:综合-主运管理;P_COMPOSITE_TRADE:综合-商旅管理;P_COMPOSITE_MATING:综合-配套商管理;P_PAY:支付系统;P_EXHIBITOR_SELF:展商自服务;P_CATERINGAPP:餐饮小程序;P_CATERING:餐饮后台服务;P_PORTAL_OUT_VENUE:对外门户-场馆后台;P_PORTAL_OUT_OPERATION:对外门户-运营后台;P_PORTAL_IN_WORK:内部门户-工作后台;P_PORTAL_IN_WORKAPP:内部门户-工作APP;P_OPERATION_CENTER:智慧运营中心系统;P_VISITOR_FRONT:访客前台系统;P_VISITOR_BACK:访客后台系统;P_R_EXHIBITOR:展商组;P_R_SPONSOR:主办组;P_R_BUILDER:搭建商组;P_R_COURT:主场组;P_R_TRANSPORT:主运组;P_R_BOOKING:场馆方组;P_R_REPAST:餐饮方组;EXHIBITOR:展商;EXHIBITOR_STAFF:展商员工;SPONSOR:主办;SPONSOR_STAFF:主办员工;BUILDER:搭建商;BUILDER_STAFF:搭建商员工;COURT:主场;COURT_STAFF:主场员工;TRANSPORT:主运;TRANSPORT_STAFF:主运员工;BOOKING:场馆方;BOOKING_STAFF:场馆方员工;REPAST:餐饮方;REPAST_STAFF:餐饮方员工;STAFF:员工;OTHER:其他}
     */
    @ApiModelProperty(value = "组织类型#{P:厦门智慧场馆;P_VENUE:场馆业务管理系统;P_CERTIFICATE:证件管理系统;P_COMPOSITE_VENUE:综合-场馆管理; P_COMPOSITE_COURT:综合-主场管理;P_COMPOSITE_PRODUCER:综合-搭建商管理;P_COMPOSITE_TRANSPORT:综合-主运管理;P_COMPOSITE_TRADE:综合-商旅管理;P_COMPOSITE_MATING:综合-配套商管理;P_PAY:支付系统;P_EXHIBITOR_SELF:展商自服务;P_CATERINGAPP:餐饮小程序;P_CATERING:餐饮后台服务;P_PORTAL_OUT_VENUE:对外门户-场馆后台;P_PORTAL_OUT_OPERATION:对外门户-运营后台;P_PORTAL_IN_WORK:内部门户-工作后台;P_PORTAL_IN_WORKAPP:内部门户-工作APP;P_OPERATION_CENTER:智慧运营中心系统;P_VISITOR_FRONT:访客前台系统;P_VISITOR_BACK:访客后台系统;P_R_EXHIBITOR:展商组;P_R_SPONSOR:主办组;P_R_BUILDER:搭建商组;P_R_COURT:主场组;P_R_TRANSPORT:主运组;P_R_BOOKING:场馆方组;P_R_REPAST:餐饮方组;EXHIBITOR:展商;EXHIBITOR_STAFF:展商员工;SPONSOR:主办;SPONSOR_STAFF:主办员工;BUILDER:搭建商;BUILDER_STAFF:搭建商员工;COURT:主场;COURT_STAFF:主场员工;TRANSPORT:主运;TRANSPORT_STAFF:主运员工;BOOKING:场馆方;BOOKING_STAFF:场馆方员工;REPAST:餐饮方;REPAST_STAFF:餐饮方员工;STAFF:员工;OTHER:其他}")
    @TableField(value = "org_type")
    @Excel(name = "组织类型#{P:厦门智慧场馆;P_VENUE:场馆业务管理系统;P_CERTIFICATE:证件管理系统;P_COMPOSITE_VENUE:综合-场馆管理; P_COMPOSITE_COURT:综合-主场管理;P_COMPOSITE_PRODUCER:综合-搭建商管理;P_COMPOSITE_TRANSPORT:综合-主运管理;P_COMPOSITE_TRADE:综合-商旅管理;P_COMPOSITE_MATING:综合-配套商管理;P_PAY:支付系统;P_EXHIBITOR_SELF:展商自服务;P_CATERINGAPP:餐饮小程序;P_CATERING:餐饮后台服务;P_PORTAL_OUT_VENUE:对外门户-场馆后台;P_PORTAL_OUT_OPERATION:对外门户-运营后台;P_PORTAL_IN_WORK:内部门户-工作后台;P_PORTAL_IN_WORKAPP:内部门户-工作APP;P_OPERATION_CENTER:智慧运营中心系统;P_VISITOR_FRONT:访客前台系统;P_VISITOR_BACK:访客后台系统;P_R_EXHIBITOR:展商组;P_R_SPONSOR:主办组;P_R_BUILDER:搭建商组;P_R_COURT:主场组;P_R_TRANSPORT:主运组;P_R_BOOKING:场馆方组;P_R_REPAST:餐饮方组;EXHIBITOR:展商;EXHIBITOR_STAFF:展商员工;SPONSOR:主办;SPONSOR_STAFF:主办员工;BUILDER:搭建商;BUILDER_STAFF:搭建商员工;COURT:主场;COURT_STAFF:主场员工;TRANSPORT:主运;TRANSPORT_STAFF:主运员工;BOOKING:场馆方;BOOKING_STAFF:场馆方员工;REPAST:餐饮方;REPAST_STAFF:餐饮方员工;STAFF:员工;OTHER:其他}", replace = {"厦门智慧场馆_P", "场馆业务管理系统_P_VENUE", "证件管理系统_P_CERTIFICATE", "综合-场馆管理_P_COMPOSITE_VENUE", "综合-主场管理_P_COMPOSITE_COURT", "综合-搭建商管理_P_COMPOSITE_PRODUCER", "综合-主运管理_P_COMPOSITE_TRANSPORT", "综合-商旅管理_P_COMPOSITE_TRADE", "综合-配套商管理_P_COMPOSITE_MATING", "支付系统_P_PAY", "展商自服务_P_EXHIBITOR_SELF", "餐饮小程序_P_CATERINGAPP", "餐饮后台服务_P_CATERING", "对外门户-场馆后台_P_PORTAL_OUT_VENUE", "对外门户-运营后台_P_PORTAL_OUT_OPERATION", "内部门户-工作后台_P_PORTAL_IN_WORK", "内部门户-工作APP_P_PORTAL_IN_WORKAPP", "智慧运营中心系统_P_OPERATION_CENTER", "访客前台系统_P_VISITOR_FRONT", "访客后台系统_P_VISITOR_BACK", "展商组_P_R_EXHIBITOR", "主办组_P_R_SPONSOR", "搭建商组_P_R_BUILDER", "主场组_P_R_COURT", "主运组_P_R_TRANSPORT", "场馆方组_P_R_BOOKING", "餐饮方组_P_R_REPAST", "展商_EXHIBITOR", "展商员工_EXHIBITOR_STAFF", "主办_SPONSOR", "主办员工_SPONSOR_STAFF", "搭建商_BUILDER", "搭建商员工_BUILDER_STAFF", "主场_COURT", "主场员工_COURT_STAFF", "主运_TRANSPORT", "主运员工_TRANSPORT_STAFF", "场馆方_BOOKING", "场馆方员工_BOOKING_STAFF", "餐饮方_REPAST", "餐饮方员工_REPAST_STAFF", "员工_STAFF", "其他_OTHER",  "_null"})
    private OrganizationOrgTypeEnum orgType;

    /**
     * 组织类型归属#{P:项目;R:资源;E:展会;}
     */
    @ApiModelProperty(value = "组织类型归属#{P:项目;R:资源;E:展会;}")
    @TableField(value = "vest_type")
    @Excel(name = "组织类型归属#{P:项目;R:资源;E:展会;}", replace = {"项目_P", "资源_R", "展会_E",  "_null"})
    private OrganizationVestTypeEnum vestType;

    /**
     * 组织code码
     */
    @ApiModelProperty(value = "组织code码")
    @Size(max = 255, message = "组织code码长度不能超过255")
    @TableField(value = "code", condition = LIKE)
    @Excel(name = "组织code码")
    private String code;

    /**
     * 父级id
     */
    @ApiModelProperty(value = "父级id")
    @TableField(value = "parent_id")
    @Excel(name = "父级id")
    private Long parentId;

    /**
     * 华为同步机构id
     */
    @ApiModelProperty(value = "华为同步机构id")
    @Size(max = 255, message = "华为同步机构id长度不能超过255")
    @TableField(value = "huawei_org_id", condition = LIKE)
    @Excel(name = "华为同步机构id")
    private String huaweiOrgId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 团队id
     */
    @ApiModelProperty(value = "团队id")
    @TableField(value = "team_id")
    @Excel(name = "团队id")
    private Long teamId;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @TableField(value = "sequence")
    @Excel(name = "排序")
    private Integer sequence;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    @TableField(value = "is_enabled")
    @Excel(name = "是否生效(默认1：可用 0:不可用)")
    private Integer isEnabled;

    /**
     * 是否删除(默认0：未删除 1:已删除)
     */
    @ApiModelProperty(value = "是否删除(默认0：未删除 1:已删除)")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除(默认0：未删除 1:已删除)")
    private Integer isDeleted;


    @Builder
    public Organization(Long id, LocalDateTime createTime, Long createdBy, LocalDateTime updateTime, Long updatedBy, 
                    String name, OrganizationOrgTypeEnum orgType, OrganizationVestTypeEnum vestType, String code, Long parentId, 
                    String huaweiOrgId, Long tenantId, Long projectId, Long subsystemId, Long teamId, Integer sequence, 
                    Integer isEnabled, Integer isDeleted) {
        this.id = id;
        this.createTime = createTime;
        this.createdBy = createdBy;
        this.updateTime = updateTime;
        this.updatedBy = updatedBy;
        this.name = name;
        this.orgType = orgType;
        this.vestType = vestType;
        this.code = code;
        this.parentId = parentId;
        this.huaweiOrgId = huaweiOrgId;
        this.tenantId = tenantId;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.teamId = teamId;
        this.sequence = sequence;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
    }

}
